home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple II Magazines (PO)
/
Nibble Volume 10, No. 08 (1989-08)(MindCraft Publishing)(Side A).zip
/
Nibble Volume 10, No. 08 (1989-08)(MindCraft Publishing)(Side A).po
/
CLEAN.S
< prev
next >
Wrap
Text File
|
1996-12-24
|
4KB
|
118 lines
******************************
* CLEAN Source Code
* By Jim Richardson
* Copyright(c) 1989
* MindCraft Publ. Corp.
* Concord, Ma 01742
* EDITOR ASSEMBLER
******************************
* Syntax: CLEAN [,Dn][,Sn]
* Installs external command "CLEAN"
* which will turn on the default or
* indicated drive for 30 seconds.
* If the diskette is a standard formatted
* disk, control will return immediately to
* BASIC.SYSTEM with no error indicated.
*-----------------
* EQUATES
*-----------------
INBUF EQU $200 ;Input buffer
EXTRNCMD EQU $BE06 ;External command vector
XTRNADDR EQU $BE50 ;External command execution
XLEN EQU $BE52 ;Command length minus one
XCNUM EQU $BE53 ;Command number (ext cmd=0)
PBITS EQU $BE54 ;Permitted parameter bits
VSLOT EQU $BE61 ;Default slot for active volume
VDRIV EQU $BE62 ;Default drive number for active volume
MLI EQU $BF00 ;Machine Language Interface
*
ORG $300
*
SETUP LDA EXTRNCMD+1
STA NXTCMD+1
LDA EXTRNCMD+2 ;Move current EXTRNCMD vector to
STA NXTCMD+2 ;our next external command vector
LDA #<ENTRY
STA EXTRNCMD+2
LDA #>ENTRY ;Change EXTRNCMD vctr to point to
STA EXTRNCMD+1 ;beginning of our code.
CLC
RTS ;Return with no error
*
ENTRY CLD ;Required by BI
LDX #0
LDY #0
PARSE JSR GBUFCHAR ;Get char from INBUF
EOR TXCLEAN,Y ;Compare it to 'CLEAN'
BNE NXTCMD ;=> Command not found
INY ;Try next char
CPY #5
BCC PARSE ;compare all five char's in name
DEY
STY XLEN ;Found! Save length(-1) of cmnd string
LDA #0
STA XCNUM ;Indicate that this is an External cmnd
LDA #$11
STA PBITS ;Filename expected but optional
* (S & D parameters didn't seem to work without Pathname allowed)
LDA #4
STA PBITS+1 ;Allow S,D parameters
LDY #>RTNADR
LDA #<RTNADR ;Return addr in A Y
STY XTRNADDR
STA XTRNADDR+1 ;Tell BI where to return
CLC ;No errors - command found
RTS ;Back to BI for more parsing
RTNADR LDA VSLOT ;Get slot number
ASL
ASL
ASL
ASL ;Slot num moved to hi nibble
STA UNITNUM ;Save $0SSS0000
LDA VDRIV ;Get drive number
LSR ;Make 2=1 or 1=0
LSR ;move 1 or 0 to carry
ROR ;move 1 or 0 to high bit (bit 7)
ADC UNITNUM ;Add drive num to slot num
STA UNITNUM ;save $DSSS0000
LDA #$00
* Reads block $00,$20,$40,$60,$80,$A0,$C0,$E0
* Takes aprox. 30 seconds required to clean heads.
TRAC STA BLOCKNUM ;Move arm over two tracks (or init to $00)
JSR MLI ;READ.BLOCK (engage head to cleaning disk)
DFB $80
DW RPARM ;We expect error if reading cleaning disk
BCC EXIT ;=>Exit if reading a "real" disk
CLC
LDA BLOCKNUM ;BLOCKNUM used to keep track of time
ADC #$20
BCC TRAC ;=> if block # < $FF
CLC ;time up
EXIT RTS ;Return to BI
*----------------------
* Subroutine
*----------------------
* Flush non-space character from INBUF:
* Written by Sandy Mossberg
*
GBUFCHAR LDA INBUF,X
INX
CMP #' '
BEQ GBUFCHAR
CMP #'a'
BCC ISUPPER
AND #$DF ;Ensure upper case
ISUPPER CMP #$8D
RTS ;EQ=CR; NE=other char
*
NXTCMD JMP $0000 ;Chain to next external command
MSB ON
TXCLEAN ASC 'CLEAN'
*------------------
* READ BLOCK PARAMETERS
*------------------
RPARM DFB $03
UNITNUM DS 1
DATA DW $2000
BLOCKNUM DW $0000